package cn.edu.scau.cmi.chenruilin.adapter;

import java.util.ArrayList;
import java.util.List;

public class AdapterOfObject implements Target{
	@Override
	public List sort(List<Student> student) {
		List<Integer> intList = new ArrayList();
		for(int i = 0; i < student.size(); i++) {
			intList.add(student.get(i).getId());
		}
		SortUtil s = new SortUtil();
		s.sortInt(intList);
		
		List<Student> student2 = new ArrayList();
		int id = 0;
		
		for(int i = 0; i < intList.size(); i++) {
			id = intList.get(i);
			for(int j = 0; j < student.size(); j++) {
				if(student.get(j).getId()==id) {
					student2.add(student.get(j));
				}
			}
		}
		return student2;
	}
}
